<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!--引入 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <!-- 必须先引入vue，  后使用element-ui -->
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <!-- 引入element 的组件库-->
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

    <script type="text/javascript" src="/admin/plugin/element-ui/httpVueLoader.js"></script>

    <!--引入layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1"></script>

</head>
<body>
<div id="app">
    <el-row style="padding: 10px 10px;">
        <el-checkbox v-model="checksetting.a1" >复制栏目和表</el-checkbox>
        <el-checkbox v-model="checksetting.a2" >复制字段</el-checkbox>
        <el-checkbox v-model="checksetting.a3" >复制按钮</el-checkbox>
        <el-checkbox v-model="checksetting.a4" >复制前端接口授权</el-checkbox>

        <el-checkbox v-model="checksetting.a5">复制自定义录入</el-checkbox>
        <el-checkbox v-model="checksetting.a6">复制自定义列表</el-checkbox>
        <el-checkbox v-model="checksetting.a7">复制自定义查询</el-checkbox>

        <el-checkbox v-model="checksetting.a8">录入自定义删除(group)</el-checkbox>
        <el-checkbox v-model="checksetting.a9">复制录入录入自定义(group)</el-checkbox>
        <el-checkbox v-model="checksetting.a10">修改录入自定义为对方项目(group)</el-checkbox>

        <el-checkbox v-model="checksetting.a11">是否创建物理表</el-checkbox>
        <el-checkbox v-model="checksetting.a12">是否重新装载</el-checkbox>



        <el-checkbox v-model="checksetting.all" @change="settingAll" >全/返选</el-checkbox>

    </el-row>
    <el-tree :lazy="true"  ref="tree" :highlight-current="true" :default-expanded-keys="treeData" show-checkbox node-key="id" :props="defaultProps" :expand-on-click-node="false" :load="getData" @node-click="handleNodeClick"></el-tree>
</div>

<script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>
<script>

    var vm = new Vue({
        el: '#app',
        data: {
            treeData:["0000"],
            defaultProps: {
                children: 'children',
                label: 'title'
            },
            checksetting:{},
        },
        created(){
            for(let a=1;a<=12;a++){
                Vue.set(this.checksetting,"a"+a,false);
            }
            // this.getData();
        },
        methods:{
            settingAll(){
                for(let a=1;a<=12;a++){
                    this.checksetting["a"+a] = this.checksetting.all;
                }
            },
            getCheckedKeys() {
                return this.$refs.tree.getCheckedKeys();
            },
            handleNodeClick(treeNode) {
            },
            //获取数据
            async getData(item,resolve){
                let parms = {};
                if(item.data == undefined){
                    parms = {token:localStorage.getItem("token"),type:"0"};
                }else {
                    parms = {type:item.data.type};
                }
                const resa = await post("/admin/api/ColumnManagementController/getOrgs", parms);
                const res = resa.data;
                let listdata = [];
                for(let a=0;a<res.length;a++){
                    listdata.push({
                        title: res[a].org_name+"["+res[a].id+"]"
                        ,id: res[a].id,
                        type:res[a].type
                    });
                }
                resolve(listdata);
            }
        }
    });


    function getData(){
        let mapda = {checksetting:vm.checksetting,ids:vm.getCheckedKeys()};
        return mapda;
    }

</script>
</body>
</html>